package com.yunxiao.cloud.web.controller;


import com.yunxiao.cloud.common.base.BaseResultResponse;
import com.yunxiao.cloud.web.entity.User;
import com.yunxiao.cloud.web.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户者个人消费汇总表 前端控制器
 * </p>
 *
 * @author yunxiao
 * @since 2020-01-19
 */
@RestController
@RequestMapping("/user")
public class UserController {


    @Autowired
    UserService userService;

    @PostMapping("/info")
    public BaseResultResponse testApi(Long id){
        User role = userService.getById(id);
        return BaseResultResponse.ok(role);
    }

    @PostMapping("/insert")
    public BaseResultResponse insert(User  user){
        boolean result = userService.save(user);
        return BaseResultResponse.ok(result);
    }
}

